package main

import (
	"fmt"
	"sync"
)
var sw sync.WaitGroup
func doWorke(id int,c chan int,done chan bool){
	sw.Add(2)
	for n:=range c{
		fmt.Printf("%d %c\n",id,n)
		sw.Done()
	}

}
type worker struct{
	in chan int
	done chan bool
}
func createworker(id int)worker{
	w:=worker{}
	w.in=make(chan int)
	w.done=make(chan bool)
	go doWorke(id,w.in,w.done)
	return w
}

func channelDemo(){
	workers:=[10]worker{}
	for i:=0;i<len(workers);i++{
		workers[i]=createworker(i)
	}
	for i:=0;i<10;i++{
		workers[i].in<-'a'+i
	}
	for i:=0;i<10;i++{
		workers[i].in<-'A'+i
	}
	sw.Wait()
}

func main() {
	channelDemo()
}
